package io.renren.modules.hospital.service.impl;

import io.renren.modules.hospital.dao.EmrXyModelDao;
import io.renren.modules.hospital.entity.EmrBlInfoEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;

import io.renren.modules.hospital.dao.EmrJdInfoDao;
import io.renren.modules.hospital.entity.EmrJdInfoEntity;
import io.renren.modules.hospital.service.EmrJdInfoService;


@Service("emrJdInfoService")
public class EmrJdInfoServiceImpl extends ServiceImpl<EmrJdInfoDao, EmrJdInfoEntity> implements EmrJdInfoService {

    @Autowired
    EmrJdInfoDao jdInfoDao;

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<EmrJdInfoEntity> page = this.page(
                new Query<EmrJdInfoEntity>().getPage(params),
                new QueryWrapper<EmrJdInfoEntity>()
        );

        return new PageUtils(page);
    }

    /**
     * 根据病历编号查找其下的病历节点
     *
     * @param blId 病历编号
     * @return 病历节点列表
     */
    public List<EmrJdInfoEntity> getJdByBlId(Integer blId) {
        return jdInfoDao.getJdByBlId(blId);
    }

    /**
     * 根据病历编号查找其下的中医医病历节点
     * @param blId 病历编号
     * @return 病历节点列表
     */
    public List<EmrJdInfoEntity> getZyJdByBlId(Integer blId){
        return jdInfoDao.getZyJdByBlId(blId);
    }

    @Override
    public Boolean saveMedicalNode(EmrJdInfoEntity jdInfo) {

        return jdInfoDao.saveMedicalNode(jdInfo);
    }
}
